﻿using System;
using System.Text;

class CountSubstrings
{
    static void Main()
    {
        string textToExplore = "We are living in an yellow submarine. We don't have anything else. Inside the submarine is very tight. So we are drinking all the day. We will move out of it in 5 days.";
        Console.WriteLine("The string is:");
        Console.WriteLine();
        Console.WriteLine(textToExplore);
        Console.WriteLine();
        Console.WriteLine("Enter a substring to search:");
        string substring = Console.ReadLine();
        int counter = 0;
        for (int index = 0; index < textToExplore.Length-1; index++)
        {
            if (textToExplore.Substring(index, substring.Length).ToLower() == substring)
            {
                counter++;
            }
        }
        Console.WriteLine();
        Console.WriteLine("The substring {0} appears {1} times in the string!",substring,counter);

        

    }
}

